#include "DrainageFactory.h"

DrainageFactory::DrainageFactory(void)
{
	this->factoryUtil = FactoryUtil::getInstance();
}

DrainageFactory::~DrainageFactory(void)
{
	delete(this->factoryUtil);
}

Element* DrainageFactory::createElement(XMLElement* element)
{
	return this->createDrainage(element);
}

Drainage* DrainageFactory::createDrainage(XMLElement* drainageElement)
{
	Drainage* drainage = new Drainage();

	string id = FactoryUtil::getInstance()->buildId(drainageElement);
	Position * position = FactoryUtil::getInstance()->buildFrogPosition(drainageElement);
	float radius = FactoryUtil::getInstance()->buildFrogRadius(drainageElement);

	drainage->setId(id);
	drainage->setPosition(position);
	drainage->setRadius(radius);
	drainage->setElementColor(FactoryUtil::getInstance()->buildDrainageBackgroundColor(drainageElement));
	drainage->setLineColor(FactoryUtil::getInstance()->buildDrainageLineColor(drainageElement));
	drainage->setTexture(FactoryUtil::getInstance()->buildDrainageTexture(drainageElement));

	return drainage;
}